package com.oi.test01.hw.timu7;

import java.lang.reflect.Field;

/**
 * @author bin
 * @date 2025 - 03 -18
 **/
public class SqlGenerate {
    public static String generateSql(Class<?> clazz) throws Exception {
        Field[] fields= clazz.getDeclaredFields();

        StringBuffer sql = new StringBuffer("select ");

        for (Field field : fields) {
            sql.append(field.getName()+",");
        }
        sql.deleteCharAt(sql.length()-1);
        sql.append(" from ");
        sql.append(clazz.getSimpleName());
        sql.append(" where 1=1 ");


      return sql.toString();
    }
}
